<%--
  Created by IntelliJ IDEA.
  User: Corvin
  Date: 04.07.14
  Time: 22:37
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="core" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
<%@page contentType="text/html" pageEncoding="UTF-8" language="java"%>

<tiles:insertDefinition name="baseTemplate">
    <tiles:putAttribute name="title">
        <title>Вход</title>
    </tiles:putAttribute>

    <tiles:putAttribute name="body">
        <div id="login_container" class="bordered">

            <core:if test="${login_failed}">
                <input type="hidden" id="error_block">
            </core:if>

            <div id="auth_block">
                <form class="login-form" action="j_spring_security_check" method="post">
                    <p><label for="j_username">Логин: </label></p>
                    <p class="input-control text" data-role="input-control">
                        <input id="j_username" name="j_username" size="20" maxlength="50" type="text" <core:if test="${register_ok}" >value="${new_user_login}"</core:if>/>
                    </p>
                    <p><label for="j_password">Пароль: </label></p>
                    <p class="input-control password" data-role="input-control">
                        <input id="j_password" name="j_password" size="20" maxlength="50" type="password" />
                    </p>

                    <p><input type="submit" class="button warning large" value="Войти" /></p>
                </form>
            </div>

            <script type="text/javascript">
                $(document).ready(function(){
                    var hidden = document.getElementById('error_block');
                    if (hidden != undefined) {
                        $.Notify({
                            "content": "Логин или пароль неверны",
                            "style": {"background": 'darkred', "color": 'white', "font": 'bold'},
                            "timeout": 8000
                        });
                    }
                });
            </script>
        </div>
    </tiles:putAttribute>
</tiles:insertDefinition>